package com.niuwa.p2p.action.protocol;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import com.niuwa.p2p.action.JsonAction;
import com.niuwa.p2p.entity.user.User;
import com.niuwa.p2p.service.protocol.IProtocolAuditService;
import com.niuwa.p2p.vo.protocol.ProtocolAuditVo;

public class ProtocolAuditAction extends JsonAction {
	private static final long serialVersionUID = -8977557918010574088L;

	@Autowired
	private IProtocolAuditService protocolAuditService;
	
	private ProtocolAuditVo protAuditVo;
	
	
	/**
	 * 协议审批操作
	 * @return
	 */
	@Action("protocolAudit")
	public String deleteProtocol() {
		User user=(User) ServletActionContext.getRequest().getSession().getAttribute("user");
		if (user!=null) {
			protAuditVo.setOperator(user.getId());
			setObjectReSult(protocolAuditService.protocolAudit(protAuditVo));
		}
		return NONE;
	}

	/**
	 * 显示操作审核对话框
	 * @return
	 */
	@Action("protAuditDetails")
	public String protAuditDetails() {
		setResult(protocolAuditService.selectProtocolAuditInfoBySelective(protAuditVo));
		return NONE;
	}

	public ProtocolAuditVo getProtAuditVo() {
		return protAuditVo;
	}

	public void setProtAuditVo(ProtocolAuditVo protAuditVo) {
		this.protAuditVo = protAuditVo;
	}
	
}
